home *** CD-ROM | disk | FTP | other *** search
/ Precision Software Appli…tions Silver Collection 4 / Precision Software Applications Silver Collection Volume 4 (1993).iso / database / sr_info.exe / MENU.PRG < prev    next >
Text File  |  1990-05-14  |  3KB  |  85 lines

  1. ***************************************************************************
  2. **  MENU.PRG 
  3. **  (C) Copyright 1990, Sub Rosa Publishing Inc.
  4. **  A demonstration program provided to SR-Info and VP-Info users.
  5. **  This program may be copied freely. If it is used in commercial code,
  6. **  please credit the source, Sub Rosa Publishing Inc.
  7. **
  8. **  MENU demonstrates the use of the MENU() function along with a variety
  9. **  of Info commands and functions.
  10. **  Menu is compatible with all current versions of SR-Info and VP-Info.
  11. **
  12. **  MENU displays a menu, determines the choice made, and takes
  13. **  action depending both on the selection and the key used to make
  14. **  the selection.
  15. **
  16. **  Bernie Melman
  17. **  April 1,1990
  18. ***************************************************************************
  19. IF :color <> 7
  20.    SET color to 31; white on blue
  21. ENDIF
  22. SET WIDTH to 80
  23. COLOR :color,0,0,24,79,177    ;fill screen with pattern
  24. * 177 is a fill character.
  25. COLOR 112,7,20,21,66          ;draw black box to become shadow
  26. WINDOW 6,18,19,62 DOUBLE COLOR :color   ;declare space for menu text
  27. ON escape
  28.    CURSOR 22,0
  29.    WINDOW
  30.    CANCEL
  31. ENDON
  32. DO WHILE t                    ;put main menu in an infinite loop
  33.    ERASE                      ;fills window with blanks
  34.    TEXT
  35.  
  36.              DEMO MAIN MENU
  37.  
  38.     0. Exit program and SR-Info.
  39.  
  40.     1. Branch 1 of sample program.
  41.     2. Do not choose this option.
  42.     3. Branch 3 - choose with function key.
  43.     4. Do not choose this option.
  44.     5. Exit program - stay in SR-Info.
  45.  
  46.    ENDTEXT
  47.    CURSOR 12,25 ; positions menu cursor over 1st character of 1st choice
  48.    selection=menu(5,37)      ;five choices menu bar width 37
  49.    DO CASE
  50.    CASE selection=0 .or. :key=327  ; <home> key
  51.       QUIT
  52.    CASE selection=1
  53.       IF :key = 13
  54.          @ 20,21 say " CHOSEN WITH ENTER KEY! Press any key. "
  55.       ELSE
  56.          IF :key < 255
  57.             @ 20,21 say " CHOSEN WITH KEY "+chr(:key)+"  Press any key. "
  58.          ELSE
  59.             @ 20,21 say " KEY WITH Info code "+str(:key,3)+" Press any key. "
  60.          ENDIF
  61.       ENDIF
  62.       dummy=inkey()         ;wait for keystroke
  63.       @ 20,21 say blank(40,205)
  64.    CASE selection=3
  65.       IF (:key < 315) .or. (:key > 324)
  66.          @ 20,21 say " NOT A Function KEY! Press any key. "
  67.       ELSE
  68.          @ 20,21 say " CHOSEN WITH F"+str(:key-314,2)+". Press any key. "
  69.       ENDIF
  70.       DUMMY = inkey()
  71.       @ 20,21 say blank(40,205)
  72.    CASE selection=5
  73.       WINDOW                  ;reset window to full screen
  74.       ERASE                   ;clear screen
  75.       CURSOR 0,0; cursor to top left
  76.       CANCEL
  77.    OTHERWISE
  78.       @ 20,21 say " ILLEGAL CHOICE! Press any key. "
  79.       DUMMY = inkey()
  80.       @ 20,21 say blank(40,205)  ;205 rebuilds double box
  81.    ENDCASE
  82. ENDDO
  83. *
  84. *                         *** end of MENU.PRG ***
  85.